package com.iweb.web.controller;

import com.iweb.commons.utils.ModelAndView;
import com.iweb.pojo.Food;
import com.iweb.service.FoodService;

import java.util.List;

/**
 * @author: jack
 * @date: 2022-08-05 0005
 * @ApiNOTE:
 */
public class FoodController {

  private FoodService foodService;

  public void setFoodService(FoodService foodService) {
    this.foodService = foodService;
  }

  public ModelAndView findAllFood() {
    List<Food> foods = foodService.findAllFood();
    ModelAndView mv = new ModelAndView();
    mv.setViewName("/WEB-INF/views/food/index.jsp");
    mv.addModel("foods", foods);
    return mv;
  }
}
